<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Ofertar Disciplina</h2>

            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" autoUpdate="true" showDetail="false"/>

                    <p class="subtitle">Dados Gerais</p>

                    <p:outputLabel value="Curso:" styleClass="grid_3" for="cursoSelectCheckboxMenu" />
                    <div class="grid_8">
                        <p:selectOneMenu id="cursoSelectCheckboxMenu"
                                         value="#{managerPesquisarOfertaDisciplina.cursoEditar}" 
                                         label="Selecione o curso" filter="true"
                                         filterMatchMode="contains"
                                         required="true"
                                         converter="cursoconverter"
                                         caseSensitive="false" panelStyle="width:220px">
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerPesquisarOfertaDisciplina.cursosEditar}" var="item" 
                                           itemLabel="#{item.codigo.concat(' - ').concat(item.nome)}" itemValue="#{item}" />  
                            <p:ajax update=":form:disciplinaSelectCheckboxMenu" listener="#{managerPesquisarOfertaDisciplina.handleMudarDisciplinas()}" />
                        </p:selectOneMenu>
                    </div>

                    <p:outputLabel value="Disciplinas:" styleClass="grid_3" >
                        <span class="ui-outputlabel-rfi">*</span>
                    </p:outputLabel>
                    <div class="grid_8">
                        <p:selectOneMenu id="disciplinaSelectCheckboxMenu"
                                         value="#{managerPesquisarOfertaDisciplina.disciplinaEditar}" 
                                         label="Selecione a(s) disciplina(s)" filter="true"
                                         filterMatchMode="contains" styleClass="grid_8"
                                         converter="disciplinaconverter" required="true"
                                         caseSensitive="false" panelStyle="width:290px">
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerPesquisarOfertaDisciplina.disciplinasEditar}" 
                                           var="item" itemLabel="#{item.nome}" itemValue="#{item}" />

                            <p:ajax update="form:docenteSelectCheckboxMenu" listener="#{managerPesquisarOfertaDisciplina.handleMudarDocente()}" />
                        </p:selectOneMenu>
                    </div>
                    <div class="clear" />

                    <p:outputLabel value="Docente:" styleClass="grid_3" for="docenteSelectCheckboxMenu" />
                    <div class="grid_8">
                        <p:selectOneMenu id="docenteSelectCheckboxMenu"
                                         value="#{managerPesquisarOfertaDisciplina.docenteEditar}" 
                                         filter="true" filterMatchMode="contains"
                                         required="true"
                                         converter="docenteconverter"
                                         caseSensitive="false" panelStyle="width:220px">
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerPesquisarOfertaDisciplina.docentesEditar}" var="item" 
                                           itemLabel="#{item.nome}" itemValue="#{item}" />  

                        </p:selectOneMenu>
                    </div>
                    <div class="clear" />

                    <p:outputLabel value="Dias:" styleClass="grid_3" for="diasSelectManyMenu" />
                    <p:selectManyButton id="diasSelectManyMenu"
                                        value="#{managerPesquisarOfertaDisciplina.diasSemanasSelecionadasEditar}" 
                                          styleClass="grid_8" converter="enumconverter" >

                        <f:selectItems value="#{managerPesquisarOfertaDisciplina.diasSemana}" />
                    </p:selectManyButton>

                    <p:outputLabel value="Horário:" styleClass="grid_3" for="horarioCalendar" />
                    <p:calendar id="horarioCalendar" value="#{managerPesquisarOfertaDisciplina.ofertaDisciplinaEditar.horario}"
                                locale="pt" yearRange="1700:2100" maxHour="22" minHour="6" 
                                timeOnly="true" navigator="true" pattern="HH:mm a" styleClass="grid_9" />

                    <div class="clear"/>

                    <p:outputLabel value="Quantidade de Alunos:" styleClass="grid_3" for="qtdAlunoInputText" />
                    <p:inputText id="qtdAlunoInputText" styleClass="grid_3"
                                 value="#{managerPesquisarOfertaDisciplina.ofertaDisciplinaEditar.quantidadeAlunos}" />
                    <div class="clear" />

                    <div class="buttonAction">
                        <p:commandButton value="Atualizar" icon="ui-icon-disk" 
                                         actionListener="#{managerPesquisarOfertaDisciplina.atualizar()}" 
                                         update="@form" styleClass="ui-priority-primary"/>
                        <p:button value="Voltar" icon="ui-icon-circle-arrow-w"
                                  href="pesquisarofertadisciplina.xhtml"/>

                    </div>
                </h:form>
            </p:panel> 
        </ui:define>
    </ui:composition>
</html>